package com.example.feign.auth;

import com.alibaba.fastjson.JSONObject;
import com.example.auth.domain.DataNodeConfig;
import com.example.auth.domain.User;
import com.example.feign.auth.impl.UserFeignServiceImpl;
import com.example.util.MethodDesc;
import com.example.util.Module;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Module(name = "认证服务模块", description = "查询用户及用户所属数据节点获取")
@FeignClient(value = "cloud-auth",fallback = UserFeignServiceImpl.class)
public interface UserFeignService {

    @MethodDesc(description = "根据用户名查找用户")
    @GetMapping("/user/search")
    public User getUserByUserName(@RequestParam("username")String username);

    @PostMapping("/user/registerUser")
    public JSONObject registerUser(@RequestParam("username")String username);

    @MethodDesc(description = "根据用户名，查找储存用户数据节点")
    @GetMapping("/user/dataNodeByUserName")
    DataNodeConfig findNodeByUsername(@RequestParam("username") String username);
}
